package com.ktgj.service.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.ContractLinkViphallPrice;
import com.ktgj.service.service.IContractLinkViphallPriceService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 合同贵宾厅价格Controller
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@ControllerAdvice
@RestController
@RequestMapping("/vipprice")
public class ContractLinkViphallPriceController extends BaseController
{
    @Autowired
    private IContractLinkViphallPriceService contractLinkViphallPriceService;

    /**
     * 查询合同贵宾厅价格列表
     */
    //@PreAuthorize(hasPermi = "service:price:list")
    @GetMapping("/list")
    public TableDataInfo list(ContractLinkViphallPrice contractLinkViphallPrice)
    {
        startPage();
        List<ContractLinkViphallPrice> list = contractLinkViphallPriceService.selectContractLinkViphallPriceList(contractLinkViphallPrice);
        return getDataTable(list);
    }

    /**
     * 导出合同贵宾厅价格列表
     */
    //@PreAuthorize(hasPermi = "service:price:export")
    @Log(title = "合同贵宾厅价格", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ContractLinkViphallPrice contractLinkViphallPrice) throws IOException
    {
        List<ContractLinkViphallPrice> list = contractLinkViphallPriceService.selectContractLinkViphallPriceList(contractLinkViphallPrice);
        ExcelUtil<ContractLinkViphallPrice> util = new ExcelUtil<ContractLinkViphallPrice>(ContractLinkViphallPrice.class);
        util.exportExcel(response, list, "合同贵宾厅价格数据");
    }

    /**
     * 获取合同贵宾厅价格详细信息
     */
    //@PreAuthorize(hasPermi = "service:price:query")
    @GetMapping(value = "/{contractViphallPriceId}")
    public AjaxResult getInfo(@PathVariable("contractViphallPriceId") Long contractViphallPriceId)
    {
        return AjaxResult.success(contractLinkViphallPriceService.selectContractLinkViphallPriceById(contractViphallPriceId));
    }

    /**
     * 新增合同贵宾厅价格*/
    //@PreAuthorize(hasPermi = "service:price:add")
    @Log(title = "合同贵宾厅价格", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ContractLinkViphallPrice contractLinkViphallPrice)
    {
        return toAjax(contractLinkViphallPriceService.insertContractLinkViphallPrice(contractLinkViphallPrice));
    }

    /**
     * 修改合同贵宾厅价格*/
    //@PreAuthorize(hasPermi = "service:price:edit")
    @Log(title = "合同贵宾厅价格", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ContractLinkViphallPrice contractLinkViphallPrice)
    {
        return toAjax(contractLinkViphallPriceService.updateContractLinkViphallPrice(contractLinkViphallPrice));
    }

    /**
     * 删除合同贵宾厅价格*/
    //@PreAuthorize(hasPermi = "service:price:remove")
    @Log(title = "合同贵宾厅价格", businessType = BusinessType.DELETE)
	@DeleteMapping("/{contractViphallPriceIds}")
    public AjaxResult remove(@PathVariable Long[] contractViphallPriceIds)
    {
        return toAjax(contractLinkViphallPriceService.deleteContractLinkViphallPriceByIds(contractViphallPriceIds));
    }
}
